import request from '@/utils/request'
import { getLang } from '@/utils/auth'
import { promises } from 'fs'
/**
 *根据textid获取国际化
 * @param {Array} i18Keys
 */
export function getI18n(i18Keys) {
  const data = {
    textId: JSON.stringify(i18Keys),
    lang: getLang()
  }
  return request({
    url: '/common/getI18N',
    method: 'post',
    data
  })
}

export function getOptions(codeType) {
  const data = {
    codeType: codeType,
    isAll: 'false',
    lang: getLang()
  }
  return request({
    url: '/common/getSingleOptions',
    method: 'get',
    params: data
  })
}

export function getOgrTree() {
  return request({
    url: '/common/org/getOrgTree',
    method: 'get'
  })
}

export function exportFile(url, params) {
  params.responseType = 'arraybuffer'
  return request({
    url: url,
    method: 'get',
    params: params
  })
}

export function query(url, params) {
  return request({
    url: url,
    method: 'get',
    params: params
  })
}

export function post(url, data) {
  return request({
    url: url,
    method: 'post',
    data
  })
}

export function postparm(url, data, params) {
  return request({
    url: url,
    method: 'post',
    params: params,
    data
  })
}

export function put(url, data) {
  return request({
    url: url,
    method: 'put',
    data
  })
}

export function del(url, params) {
  return request({
    url: url,
    method: 'delete',
    params: params
  })
}

